// part1:C12:ex12.7.cpp
// a function to return a vector<int>
// use shared_ptr.
#include <iostream>
#include <vector>
#include <memory>
using namespace std;

shared_ptr<vector<int>> new_vector(void)
{
  return make_shared<vector<int>>();
}

void read_ints(shared_ptr<vector<int>> spv)
{
  int v;
  while (cin >> v) {
    spv->push_back(v);
  }
}

void print_ints(shared_ptr<vector<int>> spv)
{
  for (const auto &v : *spv) {
    cout << v << " ";
  }
  cout << endl;
}

int main(int argc, char *argv[])
{
  auto spv = new_vector();
  read_ints(spv);
  print_ints(spv);

  return 0;
}
